import type { MaFormItem } from "@mineadmin/form";
import hasAuth from "@/utils/permission/hasAuth.ts";
import { concat } from "lodash-es";

export default function getFormItems(
  formType: "add" | "edit" = "add",
  t: any,
  model: any
): MaFormItem[] {
  return concat([
    {
      label: "服务器名称",
      prop: "name",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "" }) },
      itemProps: { rules: [{ required: true, message: "请输入服务器名称" }] },
    },
    {
      label: "服务器地址",
      prop: "link",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "" }) },
      itemProps: { rules: [{ required: true, message: "请输入IP地址" }] },
    },
    {
      label: "用户名",
      prop: "username",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "" }) },
      itemProps: { rules: [{ required: true, message: "请输入用户名" }] },
    },
    {
      label: "密码",
      prop: "password",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "" }) },
      itemProps: { rules: [{ required: true, message: "请输入密码" }] },
    },
    {
      label: "认证token",
      prop: "auth",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "" }) },
      itemProps: { rules: [{ required: true, message: "请输入认证token" }] },
    },
  ]);
}
